<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
	<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
	<title>Fancytree - Example: Menu</title>

	<link rel="stylesheet" href="http://code.jquery.com/ui/1.9.1/themes/base/jquery-ui.css">
	<script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js" type="text/javascript"></script>
	<!--
	<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1/jquery-ui.min.js" type="text/javascript"></script>
	-->
	<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1/jquery-ui.js" type="text/javascript"></script>
	<script src="http://view.jqueryui.com/menubar/ui/jquery.ui.popup.js" type="text/javascript"></script>
	<script src="http://view.jqueryui.com/menubar/ui/jquery.ui.menu.js" type="text/javascript"></script>

	<link href="../src/skin-win7/ui.fancytree.css" rel="stylesheet" type="text/css">
	<script src="../src/jquery.fancytree.js" type="text/javascript"></script>
	<script src="../src/jquery.fancytree.menu.js" type="text/javascript"></script>

	<!-- Start_Exclude: This block is not part of the sample code -->
	<link href="../lib/prettify.css" rel="stylesheet">
	<script src="../lib/prettify.js" type="text/javascript"></script>
	<link href="sample.css" rel="stylesheet" type="text/css">
	<script src="sample.js" type="text/javascript"></script>
	<!-- End_Exclude -->

<style type="text/css">
.ui-menu {
	width: 100px;
	font-size: 63%;
}
</style>

<!-- Add code to initialize the tree when the document is loaded: -->
<script type="text/javascript">
	$(function(){
		$("#tree").fancytree({
			extensions: ["menu"],
			source: {
				url: "ajax-tree-local.json"
			},
			menu: {
				selector: "#myMenu",
				position: {my: "center"},
				create: function(event, data){
//                  alert("Menu create " + data.menu + ", " + data.node);
				},
				open: function(event, data){
//                  alert("Menu create " + data.menu + ", " + data.node);
				},
				select: function(event, data){
					alert("Menu command " + data.menuId + ", " + data.node);
				},
				close: function(event, data){
				}
			},
			activate: function(e, data) {
//				alert("activate " + data.node);
			},
			lazyload: function(e, data) {
				data.result = {url: "ajax-sub2.json"}
			}
		});
		var tree = $("#tree").fancytree("getTree");

		/*
		 * Event handlers for our little demo interface
		 */

		$("button#btnResetSearch").click(function(e){
		}).attr("disabled", true);
	});
</script>
</head>
<body class="example">
	<h1>Example: 'menu' extension</h1>
	<div class="description">
		This sample shows context menu support using
		<a href="http://api.jqueryui.com/menu/" target="_blank">http://api.jqueryui.com/menu/</a>
		and <a href="http://docs.jquery.com/UI/Popup" target="_blank">http://docs.jquery.com/UI/Popup</a>.
	</div>
	<p class="warning">
		TODO: this is work in progress.
		<br>
		Note that jQuery.menu is part of jQueryUI 1.9+ and jQuery.popup is not yet released.
		See the "Tweaks - Context menu" for a working sample.
	</p>
	<div>
		<label for="skinswitcher">Skin:</label> <select id="skinswitcher"></select>
	</div>
	<!-- Add a <table> element where the tree should appear: -->
	<div id="tree">
	</div>

	<!-- Definition of context menu -->
	<ul id="myMenu" class="contextMenu ui-helper-hiddenXXX">
		<li class="edit"><a href="#edit">Edit</a></li>
		<li class="cut separator"><a href="#cut">Cut</a></li>
		<li class="copy"><a href="#copy">Copy</a></li>
		<li class="paste"><a href="#paste">Paste</a></li>
		<li class="ui-state-disabled"><a href="#delete">Delete</a></li>
		<li>---</li>
		<li class="quit separator"><a href="#quit">Quit</a></li>
		<li><a href="#save"><span class="ui-icon ui-icon-disk"></span>Save</a></li>
	</ul>

	<!-- Start_Exclude: This block is not part of the sample code -->
	<hr>
	<p class="sample-links  no_code">
		<a class="hideInsideFS" href="http://fancytree.googlecode.com">jquery.fancytree.js project home</a>
		<a class="hideOutsideFS" href="#">Link to this page</a>
		<a class="hideInsideFS" href="index.html">Example Browser</a>
		<a href="#" id="codeExample">View source code</a>
	</p>
	<pre id="sourceCode" class="prettyprint" style="display:none"></pre>
	<!-- End_Exclude -->
</body>
</html>
